
use.interval=0.0001
use.table=qnorm(seq(use.interval,1-use.interval,use.interval))
n.table.options=length(use.table)


simulate.DMC=function(N,params,maxCounter,stepSize,congruency,use.table,n.table.options) {
  
  rts=rep(0,N)
  resps=rep(0,N)
  
  gamma=params["gamma"]*congruency
  
  z=(params["z"]*(params["a"]+params["a"]))-params["a"]
  
  tmp=.C("DMC",z=z,v=params["v"],
         aU=params["a"],aL=-params["a"],ter=params["ter"],
         sv=params["sv"],sz=params["sz"],ster=params["ster"],sTimeVar=params["sv"],
         gamma=gamma,alpha=params["alpha"],tau=params["tau"],
         s=params["stoch.s"],h=stepSize,resp=resps,rt=rts,
         n=N,maxiter=as.double(round(maxCounter)),
         rangeLow=as.integer(0),rangeHigh=as.integer(n.table.options-1),
         randomTable=as.double(use.table)) 
  
  out=list(rt=tmp$rt,resp=tmp$resp)
}

